﻿@page "/dictmanager"
@inject DialogService DialogService
@attribute [TabItemOption(Text = "数字字典管理", Icon = "fa-fw fa-solid fa-desktop")]
<style>
    .table tbody tr.active:not(.is-edit), .table-row.active {
        --bs-table-bg-type: #ffc107;
    }
</style>
<h3 class="text-info">说明:点击左侧字典类型表格某行</h3>
<br />
<div class="row">
    <div class="col-md-6">
        <!-- 左侧字典类型表格 -->
        <Table TItem="SysDictType" Items="master" title="左侧字典类型表格"
               ShowExtendButtons="true" ShowToolbar="true" ShowRefresh="false" ShowSearch="true" ShowAdvancedSearch="false" ShowDeleteButton="false" ShowEditButton="false"
               ClickToSelect="true"
               IsPagination="true" PageItemsSource="@(new int[] {  5, 10, 50})"
               OnSaveAsync="OnSaveSysDictTypeAsync" OnDeleteAsync="OnDeleteSysDictTypeAsync" OnQueryAsync="OnQuerySysDictTypeAsync" OnClickRowCallback="OnClickSysDictTypeRow">
            <TableColumns>
                <TableColumn @bind-Field="@context.TypeName"></TableColumn>
                <TableColumn @bind-Field="@context.TypeCode"></TableColumn>
                <TableColumn @bind-Field="@context.Status"></TableColumn>
            </TableColumns>
        </Table>
    </div>
    <!-- 右侧字典数据表格 -->
    <div class="col-md-6">
        @if (selectedDictType != null)
        {
            <Table TItem="SysDictData" @key="SysDictDataKey" Items="detailData" title="右侧字典数据表格"
                   ShowExtendButtons="true" ShowToolbar="true" ShowRefresh="false" ShowDeleteButton="false" ShowEditButton="false"
                   OnSaveAsync="OnSaveSysDictDataAsync" OnDeleteAsync="OnDeleteSysDictDataAsync">
                <TableColumns>
                    <TableColumn @bind-Field="@context.Label"></TableColumn>
                    <TableColumn @bind-Field="@context.Value"></TableColumn>
                    <TableColumn @bind-Field="@context.Status"></TableColumn>
                </TableColumns>
            </Table>
        }
    </div>
</div>

